<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <table border="">
        <thead>
            <tr>
                <th>name</th>
                <th>age</th>
                <th>gender</th>
            </tr>
        </thead>
        <tbody id="tb"></tbody>
    </table>
    <script>
        var arr = [{
            name: "Jack",
            age: 18,
            gender: "男",
        }, {
            name: "Rose",
            age: 20,
            gender: "女",
        }, {
            name: "Top",
            age: 22,
            gender: "男",
        }, ];
        var res = "";
        for (var i in arr) {
            res += "<tr>";
            for (var j in arr[i]) {
                res += "<td>" + arr[i][j] + "</td>";
            }
            res += "<tr>";
        }
        console.log(res);
        var otb = document.getElementById("tb");
        otb.innerHTML = res;
    </script>
</body>

</html>